package org.zxy.cxf;

import org.apache.cxf.endpoint.Server;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

public class MyServer {
	public static void main(String[] args) {
		JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
		factory.setServiceClass(MyServiceImpl.class);
		factory.setAddress("http://localhost:8080/myservice");
		
		//拦截显示client端发过来的soap请求和server端的soap响应，或者在tcpmon中更好的展示
		factory.getInInterceptors().add(new LoggingInInterceptor());
		factory.getOutInterceptors().add(new LoggingOutInterceptor());
		
		Server server = factory.create();
		server.start();
	}
}
